#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int Isleap(int y)
{
	int flag = 0;
	if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0)
		flag = 1;
	return flag;
}

int  IsDate(int y, int m, int d)
{
	int flag = 0;
	switch (m)
	{
	case 1:
	case 3:
	case 5:
	case 7:
	case 8:
	case 10:
	case 12:
		if (d > 0 && d <= 31)
			flag = 1;
		break;
	case 4:
	case 6:
	case 9:
	case 11:
		if (d > 0 && d <= 30)
			flag = 1;
		break;
	case 2:
		if (Isleap(y) == 1)
		{
			if (d > 0 && d <= 29)
				flag = 1;
		}
		else
		{
			if (d > 0 && d <= 28)
				flag = 1;
		}
	default:
		break;	
	}
	return flag;
}

int Days(int y, int m, int d)
{
	int sum = 0;
	if (IsDate(y, m, d) == 1)
	{
		switch (m)
		{
		case 12:
			sum += 30;
		case 11:
			sum += 31;
		case 10:
			sum += 30;
		case 9:
			sum += 31;
		case 8:
			sum += 31;
		case 7:
			sum += 30;
		case 6:
			sum += 31;
		case 5:
			sum += 30;
		case 4:
			sum += 31;
		case 3:
			if (Isleap(y) == 1)
				sum += 29;
			else
				sum += 28;
		case 2:
			sum += 31;
		case 1:
			sum += d;
			break;
		default:
			break;
		}
	}
	return sum;
}

int main()
{
	int y, m, d;
	scanf("%d-%d-%d", &y, &m, &d);
	if (IsDate(y, m, d)==0)
	{
		printf("DateError\n");
	}
	else
	{
		printf("NO:%d", Days(y, m, d));
	}
	return 0;
}